package com.pine.manager.pineframework.convertors;

import com.pine.common.beans.pineframework.request.SysRoleUserQueryRequest;
import com.pine.common.beans.pineframework.response.SysRoleUserQueryResponse;
import com.pine.common.convertor.EntityConvertor;
import com.pine.common.convertor.QueryConvertor;
import com.pine.dao.pineframework.entity.SysRoleUser;
import com.pine.manager.pineframework.bo.SysRoleUserBo;
import com.pine.manager.pineframework.query.SysRoleUserQuery;
import org.mapstruct.AfterMapping;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;

import java.util.List;

/**
 * <p>
 * 用户角色表 转换器
 * </p>
 *
 * @author pine manage
 * @since 2024-08-12
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
public abstract class SysRoleUserConvertor implements EntityConvertor<SysRoleUser, SysRoleUserBo>,
        QueryConvertor<SysRoleUserBo, SysRoleUserQuery, SysRoleUserQueryRequest, SysRoleUserQueryResponse> {

    @Override
    public abstract SysRoleUser entityBoToEntity(SysRoleUserBo sysRoleUserBo);

    @Override
    public abstract SysRoleUserBo entityToEntityBo(SysRoleUser sysRoleUser);

    @Override
    public abstract SysRoleUserQueryResponse entityBoToQueryResponse(SysRoleUserBo sysRoleUserBo);

    @Override
    public abstract SysRoleUserQuery queryRequestToQuery(SysRoleUserQueryRequest queryRequest);


    @Override
    public abstract List<SysRoleUser> entityBoToEntity(List<SysRoleUserBo> entityBo);

    @Override
    public abstract List<SysRoleUserBo> entityToEntityBo(List<SysRoleUser> entity);



    @AfterMapping
    public void afterMappingEntityBoToEntity(@MappingTarget SysRoleUser sysRoleUser, SysRoleUserBo sysRoleUserBo) {
        // entityBoToEntity() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToEntity()
    }

    @AfterMapping
    public void afterMappingEntityToEntityBo(@MappingTarget SysRoleUserBo sysRoleUserBo, SysRoleUser sysRoleUser) {
        // entityToEntityBo() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityToEntityBo()
    }

    @AfterMapping
    public void afterMappingQueryRequestToQuery(@MappingTarget SysRoleUserQuery sysRoleUserQuery, SysRoleUserQueryRequest sysRoleUserQueryRequest) {
        // queryRequestToQuery() 内部其它代码执行完之后，最后会自动执行 afterMappingQueryRequestToQuery()
    }

    @AfterMapping
    public void afterMappingEntityBoToQueryResponse(@MappingTarget SysRoleUserQueryResponse sysRoleUserQueryResponse, SysRoleUserBo sysRoleUserBo) {
        // entityBoToQueryResponse() 内部其它代码执行完之后，最后会自动执行 afterMappingEntityBoToQueryResponse()
    }


}
